﻿myApp.controller("eventDetailController", function ($scope, $http, $modal, modalService, $routeParams, $location) {
    $scope.share = {};
    function pageInit() {
        var url = 'api/Events/GetEvent/' + $routeParams.id;
        $http.get(url).success(function (data) {
            $scope.Event = data.Events;
            $scope.Event.StartDateTime = new Date($scope.Event.StartDateTime);
            $scope.Event.EndDateTime = new Date($scope.Event.EndDateTime);
            $scope.slides = data.pictureList;


            $scope.share.url = 'http://www.penangrealty.my/EventDetail/' + $routeParams.id.toString();
            $scope.share.pictureUrl = $scope.slides ? $scope.slides[0].pictureURL : 'http://www.penangrealty.my/images/penang realty,Apartment,house,condominium,terrace house,semi d,detached,bungalow,high end luxury properties,landed properties,gated guarded house.png';
            $scope.share.description = "[" + $scope.Event.Name + '] ' + $scope.Event.Venue + "\n" + $scope.Event.StartDateTime + " - " + $scope.Event.EndDateTime
+ '\n' + $scope.Event.Details + '\n' + window.location.href + '\n';

            document.title = "Penang Realty 世界地產 " + $scope.Event.Name;
            $scope.$emit('newPageLoaded', { 'title': $scope.Event.Name, 'description': $scope.share.description });
        })

    }
    pageInit();
});